﻿CREATE PROCEDURE [dbo].[AddModel]
	@ModelId uniqueidentifier,
	@Name nvarchar(50),
	@CreatedBy uniqueidentifier,
    @IsDeleted bit,
	@CreatedOn datetime,
    @LastChanged datetime,
	@LastChangedBy uniqueidentifier,

	@TimeStamp timestamp output

AS

	INSERT INTO Model 

	(ModelId, Name, CreatedBy, IsDeleted, CreatedOn, LastChanged, LastChangedBy)

	VALUES 

	(@ModelId, @Name, @CreatedBy, @IsDeleted, @CreatedOn, @LastChanged, @LastChangedBy)

	SELECT @TimeStamp = [TimeStamp]

	FROM Model WHERE ModelId=@ModelId

RETURN 0